package com.myacg.platform.ui.component.pane;

import java.awt.Color;

import com.myacg.platform.ui.event.drag.ComponentDragEvent;
import com.myacg.platform.ui.event.drag.Drag;
/**
 * 拖拽窗体
 * @author Administrator
 *
 */
public class DragPane extends DefaltPane  implements Drag{
	public DragPane(int width, int height, Color color) {
		super(width, height, color);
		new ComponentDragEvent(this, this).setDraftingEvent();
	}
	
	@Override
	public void mousePressed() {
		System.out.println("按下");
	}
	@Override
	public void mouseDragged() {
		System.out.println("拖动");
	}
	@Override
	public void mouseReleased() {
		System.out.println("松开");
	}

	@Override
	public boolean skipDrag(int mousex,int mousey) {
		//若鼠标位于父组件（父面板）之外 则不移动  —— 不能超过父面板
		return !this.getParent().getBounds().contains(mousex,mousey);
	}
	
}
